//
//  DeliveryCell.m
//  OrderSeat
//
//  Created by haiming on 13-10-14.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "DeliveryCell.h"

@implementation DeliveryCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setContent:(NSDictionary*)dictionary
{
    NSLog(@"%@", dictionary);
    NSString *tel = [dictionary objectForKey:@"tel"];
    NSString *address = [dictionary objectForKey:@"xianqu"];
    
    _nameLabel.text = [dictionary objectForKey:@"name"];
    _addressLabel.text = [NSString stringWithFormat:@"地址:%@",address];
    _tagLabel.text = [NSString stringWithFormat:@"%@",tel];
    
    float distance = [[dictionary objectForKey:@"juli"] floatValue];
    float distanceKM = distance / 1000;
    NSString *str_distance = [NSString stringWithFormat:@"%0.1f千米",distanceKM];
    if (distance < 1000) {
        str_distance = [NSString stringWithFormat:@"%0.1f米",distance];
    }

    _distanceLabel.text = str_distance;
    
    [self reLayoutSubviews];
}

- (void)reLayoutSubviews
{
    [_view drawBorder];
    [_addressLabel autoHeightForMutiLines];
}

@end
